home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / disp182a.zip / DRVSRC / ET4000.ASM < prev    next >
Assembly Source File  |  1993-07-31  |  15KB  |  505 lines

  1. ;--------------------------------------------------------------------------
  2. ; This is file ET4000.ASM
  3. ;
  4. ; Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  5. ; Copyright (C) 1992 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
  6. ;
  7. ; This file is distributed under the terms listed in the document
  8. ; "copying.dj", available from DJ Delorie at the address above.
  9. ; A copy of "copying.dj" should accompany this file; if not, a copy
  10. ; should be available from where this file was obtained.  This file
  11. ; may not be distributed without a verbatim copy of "copying.dj".
  12. ;
  13. ; This file is distributed WITHOUT ANY WARRANTY; without even the implied
  14. ; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. ;--------------------------------------------------------------------------
  16.  
  17. include grdriver.inc
  18. cseg    segment byte public 'code'
  19.     assume  cs:cseg, ds:cseg, es:cseg, ss:nothing
  20.  
  21.  
  22. ;--------------------------------------------------------------------------
  23. ; DRIVER HEADER
  24. ;  The following entries MUST match the structure and constant
  25. ;  declarations in the file 'grdriver.h' of the GRX graphics library
  26. ;  The mode word should contain the following bitfields:
  27. ;     - the GRD_NEW_DRIVER bit set for any new format driver
  28. ;     - the adapter type field should be specified
  29. ;     - the memory size field should be specified
  30. ;     - the paging mode field should be specified
  31. ;  The mode set routine will OR in the plane bitfield as it will
  32. ;  change when different color number modes are requested.
  33. ;--------------------------------------------------------------------------
  34.  
  35.     dw    offset mode_set_routine
  36.     dw    offset paging_routine
  37. mode_W  dw    GRD_NEW_DRIVER+GRD_VGA+GRD_1024K+GRD_RW_64K
  38. ;
  39. ; The 'def_xx' fields are filled in by go32 from the corresponding
  40. ; fields of the 'GO32' environment variable
  41. ;
  42. def_tw  dw    80         ; text width
  43. def_th  dw    25         ; text height
  44. def_gw  dw    640        ; graphics width
  45. def_gh  dw    480        ; graphics height
  46. def_nc  dw    256        ; graphics colors
  47.     dw    offset driver_init_routine
  48.     dw    offset text_mode_table
  49.     dw    offset graphics_mode_table
  50.  
  51. ;
  52. ; Biggest text and graphics sizes
  53. ;
  54. Max_TW  equ    132
  55. Max_TH  equ    50
  56. Max_GWn equ    800        ; non interlaced!!!
  57. Max_GHn equ    600
  58. Max_GW  equ    1024        ; may be interlaced
  59. Max_GH  equ    768
  60.  
  61.  
  62. ;--------------------------------------------------------------------------
  63. ; TABLE OF SUPPORTED TEXT MODES
  64. ;    - keep sorted by size
  65. ;    - end with an all 0 entry
  66. ;    - BIOS field = 0xff disables it
  67. ;    - fields:
  68. ;        width,  height, colors, BIOS#+  setup_procedure_index*256
  69. ;--------------------------------------------------------------------------
  70. text_mode_table           label word
  71.     dw    80,    25,    2,    007h +  00000h
  72.     dw    40,    25,    16,    001h +  00000h
  73.     dw    80,    25,    16,    003h +  00000h
  74.     dw    80,    50,    16,    003h +  00100h
  75.     dw    80,    60,    16,    026h +  00000h
  76.     dw    100,    40,    16,    02ah +  00000h
  77.     dw    132,    25,    16,    023h +  00000h
  78.     dw    132,    28,    16,    024h +  00000h
  79.     dw    132,    44,    16,    022h +  00000h
  80. ;    dw    132,    50,    16,    061h +  00000h
  81.     dw    132,    60,    16,    021h +  00000h
  82.     dw    0,    0,    0,    000h +  00000h
  83.  
  84.  
  85. ;--------------------------------------------------------------------------
  86. ; TABLE OF SUPPORTED GRAPHICS MODES
  87. ;    - keep sorted first by colors then by size
  88. ;    - end with an all 0 entry
  89. ;    - BIOS field = 0xff disables it
  90. ;    - fields:
  91. ;        width,  height, colors, BIOS#+  setup_procedure_index*256
  92. ;--------------------------------------------------------------------------
  93. graphics_mode_table    label word
  94.     dw    320,    200,    16,    00dh +  00000h
  95.     dw    640,    200,    16,    00eh +  00000h
  96.     dw    640,    350,    16,    010h +  00000h
  97.     dw    640,    480,    16,    012h +  00000h
  98.     dw    800,    600,    16,    029h +  00000h
  99.     dw    1024,    768,    16,    037h +  00000h
  100.     dw    320,    200,    256,    013h +  00000h
  101.     dw    640,    350,    256,    02dh +  00000h
  102.         dw    640,    400,    256,    02fh +  00000h
  103.     dw    640,    480,    256,    02eh +  00000h
  104.     dw    800,    600,    256,    030h +  00000h
  105.     dw    1024,    768,    256,    038h +  00000h
  106. ET4000_HiColor_Table    label word
  107.     dw    320,    200,    32768,  013h +  00200h  ; 15 bits
  108.     dw    640,    350,    32768,  02dh +  00200h  ; 15 bits
  109.         dw    640,    400,    32768,  02fh +  00200h  ; 15 bits
  110.     dw    640,    480,    32768,  02eh +  00200h  ; 15 bits
  111.     dw    800,    600,    32768,  030h +  00200h  ; 15 bits
  112.  
  113.     dw    320,    200,    0c010h, 013h +  00300h  ; 16 bits
  114.         dw    640,    350,    0c010h, 02dh +  00300h  ; 16 bits
  115.         dw    640,    400,    0c010h, 02fh +  00300h  ; 16 bits
  116.         dw    640,    480,    0c010h, 02eh +  00300h  ; 16 bits
  117.     dw    800,    600,    0c010h, 030h +  00300h  ; 16 bits
  118.  
  119. ;    dw    320,    200,    0c018h, 013h +  00400h    ; 24 bits
  120.         dw    640,    350,    0c018h, 02dh +  00400h  ; 24 bits
  121.         dw    640,    400,    0c018h, 02fh +  00400h  ; 24 bits
  122.         dw    640,    480,    0c018h, 02eh +  00400h  ; 24 bits
  123.  
  124. ET4000_HiColor_EndTable label word
  125.     dw    0,     0,      0,        000h +  00000h
  126.  
  127.  
  128. ;--------------------------------------------------------------------------
  129. ; TABLE OF SPECIAL SETUP PROCEDURES
  130. ;  You may need such procedures for:
  131. ;     -- reloading fonts on standard EGA or VGA for
  132. ;     higher resolution text modes
  133. ;     -- enable HiColor mode of some Super VGAs
  134. ;     -- Handle the parameter passing conventions of the VESA BIOS
  135. ;     -- put VGA into 256 color plane mode ("MODE X")
  136. ;     -- etc...
  137. ;  There should be one entry in the table for every non-zero
  138. ;  'setup_procedure_index' in the text and graphics mode tables.
  139. ;  The first entry in the table belongs to index 100h, and so on.
  140. ;  The special setup procedure is invoked via a near call.
  141. ;
  142. ;  Entry: DI=address of the mode record from the text or graphics
  143. ;      table to set up.
  144. ;
  145. ;  Exit:  Adapter configured
  146. ;      BX=driver mode word as it should be returned by the mode set
  147. ;         routine. Typically it involves picking up the mode word
  148. ;         from the header and OR-ing in the appropriate bitplane mode
  149. ;         bitfield. (This is not needed for text modes)
  150. ;      AX, CX, DX, SI can be trashed, PRESERVE DI!!!!
  151. ;
  152. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  153. ;--------------------------------------------------------------------------
  154. special_setup_table    label word
  155.     dw    offset  VGA_50row_mode_set
  156.     dw    offset  ET4000_HiColor_setup1
  157.     dw    offset  ET4000_HiColor_setup2
  158.     dw    offset  ET4000_HiColor_setup3
  159.  
  160. ;
  161. ; Routine to set up VGA 50 row mode
  162. ; interface is described above
  163. ;
  164. VGA_50row_mode_set    proc    near
  165.     mov    ax,03h            ; set 80x25 mode
  166.     int    10h
  167.     xor    bx,bx
  168.     mov    ax,1112h        ; load 8x8 font
  169.     int    10h
  170.     ret
  171. VGA_50row_mode_set       endp
  172.  
  173. ;
  174. ; Routine to set up ET4000 HiColor modes
  175. ; interface is described above
  176. ;
  177. ET4000_HiColor_setup1    proc    near
  178.     mov    al,BYTE PTR [di+6]    ; set up 256 colors w/ same WxH
  179.     xor    ah,ah
  180.     int    10h
  181.     mov    ax,10f0h
  182.     mov    bl,BYTE PTR [di+6]
  183.     int    10h                  ; set up HiColor w/ same size
  184.     cmp    ax,10h            ; success ?
  185.     je    ET4000_HiColor_Success1
  186.     mov    al,BYTE PTR [di+6]    ; go with the 256 color mode!
  187.     xor    ah,ah
  188.     int    10h
  189.     mov    BYTE PTR [di+6],0ffh;    ; disable this entry
  190.     mov    bx,GRD_8_PLANES
  191.     jmp    ET4000_HiColor_EndProc1
  192. ET4000_HiColor_Success1:
  193.     mov    bx,GRD_16_PLANES
  194. ET4000_HiColor_EndProc1:
  195.     or    bx,mode_W
  196.     ret
  197. ET4000_HiColor_setup1     endp
  198.  
  199.  
  200. ET4000_HiColor_setup2    proc    near
  201.     mov    al,BYTE PTR [di+6]    ; set up 256 colors w/ same WxH
  202.     xor    ah,ah
  203.     int    10h
  204.     mov    ax,10f0h
  205.     mov    bl,BYTE PTR [di+6]
  206.     int    10h                  ; set up HiColor w/ same size
  207.     cmp    ax,10h                    ; success ?
  208.         jne    back_256_2
  209.         mov    ax,10f2h
  210.         mov    bl,2
  211.         int    10h
  212.         cmp    ax,10h
  213.         jne    back_256_2
  214.         cmp    bl,2
  215.     je     ET4000_HiColor_Success2
  216. back_256_2:
  217.     mov    al,BYTE PTR [di+6]    ; go with the 256 color mode!
  218.     xor    ah,ah
  219.     int    10h
  220.     mov    BYTE PTR [di+6],0ffh;    ; disable this entry
  221.     mov    bx,GRD_8_PLANES
  222.     jmp    ET4000_HiColor_EndProc2
  223. ET4000_HiColor_Success2:
  224.     mov    bx,GRD_16X_PLANES
  225. ET4000_HiColor_EndProc2:
  226.     or    bx,mode_W
  227.     ret
  228. ET4000_HiColor_setup2     endp
  229.  
  230. ET4000_HiColor_setup3    proc    near
  231.     mov    al,BYTE PTR [di+6]    ; set up 256 colors w/ same WxH
  232.     xor    ah,ah
  233.     int    10h
  234.     mov    ax,10f0h
  235.     mov    bh,BYTE PTR [di+6]
  236.         mov    bl,0ffh
  237.     int    10h                    ; set up HiColor w/ same size
  238.     cmp    ax,10h               ; success ?
  239.     je     ET4000_HiColor_Success3
  240. back_256_3:
  241.     mov    al,BYTE PTR [di+6]    ; go with the 256 color mode!
  242.     xor    ah,ah
  243.     in